from sklearn.neighbors import KNeighborsClassifier
import numpy as np


if __name__ == '__main__':
    rawDataX = [[3.393533211, 2.331273381],
                [3.110073483, 1.781539638],
                [1.343808831, 3.368360954],
                [3.582294042, 4.679179110],
                [2.280362439, 2.866990263],
                [7.423436942, 4.696522875],
                [5.745051997, 3.533989803],
                [9.172168622, 2.511101045],
                [7.792783481, 3.424088941],
                [7.939820817, 0.791637231]
                ]
    rawDataY = [0, 0, 0, 0, 0, 1, 1, 1, 1, 1]

    xTrain = np.array(rawDataX)
    yTrain = np.array(rawDataY)

    knnClassifier = KNeighborsClassifier(n_neighbors=6)

    knnClassifier.fit(xTrain, yTrain)

    x = np.array([8.093607318, 3.365731514])
    xPredict = x.reshape(1, -1)
    print(xPredict)
    yPredict = knnClassifier.predict(xPredict)
    print(yPredict)

    print(xTrain.shape)


